/*
 * @Author: szx
 * @Date: 2022-04-12 12:42:59
 * @LastEditTime: 2022-04-12 13:06:45
 * @Description:
 * @FilePath: \leetcode\300-399\357\357.js
 */
/**
 * @param {number} n
 * @return {number}
 */
var countNumbersWithUniqueDigits = function (n) {
    if (n === 0) return 1;
    if (n === 1) return 10;

    let res = 10,
        cur = 9;
    for (let i = 0; i < n - 1; i++) {
        cur *= 9 - i;
        res += cur;
    }
    return res;
};
